#pragma once
#ifndef _SIGN_HEADER_HPP_
#define _SIGN_HEADER_HPP_

#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/epoll.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/select.h>
#include <assert.h>
#include <signal.h>

#define TIMESOLT 5
#define MAX_EVENTS_NUM 1024
#define FD_LIMIT 65535

inline const int SetNoBlocking(int fd)
{
    int old_option = fcntl(fd,F_GETFL);
    int new_option = old_option | O_NONBLOCK;
    fcntl(fd,F_SETFL,new_option);
    return new_option;
}

inline const void AddFd(int epollfd,int fd)
{
    epoll_event event;
    event.data.fd = fd;
    event.events = EPOLLET | EPOLLIN;
    epoll_ctl(epollfd,EPOLL_CTL_ADD,fd,&event);
    SetNoBlocking(fd);
}
#endif